﻿<%@ Page Title="Поиск людей --- Smart Dating" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="Search.aspx.cs" Inherits="WebUI.Search" %>
<%@ Import Namespace="WebUI" %>
<%@ Import Namespace="WebUI.SmartDatingRef" %>
<%@ Register Assembly="TabStrip" Namespace="TabStrip" TagPrefix="tc" %>

<asp:Content ID="HeadContents" ContentPlaceHolderID="HeadContent" runat="server">
    <script type="text/javascript" src="Scripts/pwn_css.js"></script>
    <script type="text/javascript" src="Scripts/expando.js"></script>
    <link rel="stylesheet" type="text/css" href="Styles/Map.css"/>
    <script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=true&key=ABQIAAAAegU6asN6GoBRry4OXotuaxS6EqoafLsqtczoJvE4RdPZ3pik6xQ7ywLMXmfFlS8qHnxJF-LcTJA6uw">
    </script>
    <script type="text/javascript" src="Scripts/layout-map.js">
    </script>
</asp:Content>
<asp:Content ID="BodyContents" ContentPlaceHolderID="MainContent" runat="server">
    <h1>Поиск людей</h1>
    <div>
        <span class="short_description">
            Установите критерии поиска, и <em>Smart Dating</em> найдет удовлетворяющих им пользователей. <br />
            Если ваше местоположение известно, первыми в результатах появятся наиболее близкие к вам пользователи.
        </span>
    </div>

    <div>
        <span id="errSpan" runat="server" class="errSpan" style="display: none;"></span>
    </div>

    <tc:Expando runat="server" IsExpanded="true" ID="expCriterias" Caption="Критерии поиска" ExpandedCaptionCssClass="expando_caption expanded" CollapsedCaptionCssClass="expando_caption collapsed" ContentsCssClass="expando_contents" CssClass="expando_container">
        <div>            
            <input type="checkbox" id="chkName" checked="checked" class="styled" runat="server" clientidmode="Static" /><span class="vat"><label for="chkName">Часть имени/фамилии:</label>
            <input type="text" id="txtName" maxlength="200" runat="server" /></span>
            <br />

            <input type="checkbox" id="chkGender" class="styled" runat="server" clientidmode="Static" /><span class="vat"><label for="chkGender">Пол:</label>
            <select id="cboGender" class="styled" runat="server">
                <option runat="server" value="0">мужской</option>
                <option runat="server" value="1">женский</option>
                <option runat="server" value="2">неопределенный</option>
            </select></span>
            <br />

            <input type="checkbox" id="chkAge" class="styled" runat="server" clientidmode="Static" /><span class="vat"><label for="chkAge">Возраст (&ge;):</label>
            <input type="text" id="txtAge" class="microsize_num" runat="server" /></span>
            <br />

            <input type="checkbox" id="chkOrientation" class="styled" runat="server" clientidmode="Static" /><span class="vat"><label for="chkOrientation">Ориентация:</label>
            <select id="cboOrientation" class="styled" runat="server">
                <option runat="server" value="0">традиционная</option>
                <option runat="server" value="1">нетрадиционная</option>
                <option runat="server" value="2">би</option>
            </select></span>
            <br />

            <input type="checkbox" id="chkReason" class="styled" runat="server" clientidmode="Static" /><span class="vat"><label for="chkReason">Цель знакомства:</label>
            <select id="cboReason" class="styled" runat="server">
                <option runat="server" value="0">спонсор</option>
                <option runat="server" value="1">друг/подруга</option>
                <option runat="server" value="2">любовница/любовник</option>
                <option runat="server" value="3">муж/жена</option>
                <option runat="server" value="4">шофер, батут и клоун</option>
            </select></span>
            <br />

            <input type="checkbox" id="chkZodiac" class="styled" runat="server" clientidmode="Static" /><span class="vat"><label for="chkZodiac">Знак зодиака:</label>
            <select id="cboZodiac" class="styled" runat="server">
                <option runat="server" value="0">водолей</option>
                <option runat="server" value="1">рыбы</option>
                <option runat="server" value="2">овен</option>
                <option runat="server" value="3">телец</option>
                <option runat="server" value="4">близнецы</option>
                <option runat="server" value="5">рак</option>
                <option runat="server" value="6">лев</option>
                <option runat="server" value="7">дева</option>
                <option runat="server" value="8">весы</option>
                <option runat="server" value="9">скорпион</option>
                <option runat="server" value="10">стрелец</option>
                <option runat="server" value="11">козерог</option>
            </select></span>
            <br />

            <input type="checkbox" id="chkInterests" class="styled" runat="server" clientidmode="Static" /><span class="vat"><label for="chkInterests">Интерес:</label>
            <input type="text" id="txtInterests" runat="server" /></span>
            <br />            

            <input type="checkbox" id="chkBio" class="styled" runat="server" clientidmode="Static" /><span class="vat"><label for="chkBio">Фрагмент текста &laquo;кратко о себе&raquo;:</label>
            <input type="text" id="txtBio" class="doublewide" runat="server" /></span>
        </div>
        <asp:LinkButton runat="server" id="cmdSearch" CssClass="linkbtn findbtn" Text="Искать людей" OnClick="cmdSearch_Click" />
    </tc:Expando>

    <tc:Expando runat="server" IsExpanded="true" ID="expResults" Caption="Результаты поиска" ExpandedCaptionCssClass="expando_caption expanded" CollapsedCaptionCssClass="expando_caption collapsed" ContentsCssClass="expando_contents" CssClass="expando_container">
        <div class="bordered defaultpadding">
            <div class="tbl" style="display: block;">
                <asp:ListView runat="server" ID="rptResults">
                    <ItemTemplate>
                        <div class="usr" style="display: block;">
                            <div class="cell defaultpadding">
                                <asp:Image runat="server" ID="imgMe" ImageAlign="Middle" CssClass="small_photo" ImageUrl='<%#"Photo.aspx?id=" + Utils.UsrId(Container.DataItem)%>' AlternateText='<%#Utils.UsrFirstName(Container.DataItem) + " " + Utils.UsrLastName(Container.DataItem)%>' /><br />
                            </div>
                            <div class="cell padding_notopleft">
                                <asp:Image runat="server" ID="imgGender" ImageUrl='<%#"Images/gender_" + Utils.UsrGender(Container.DataItem) + ".png" %>' AlternateText="Пол" />
                                <span class="user_name_in_search"><%#Utils.UsrFirstName(Container.DataItem) + " " + Utils.UsrLastName(Container.DataItem) %></span>
                                <span class="user_age_in_search"><%#Utils.UsrAge(Container.DataItem) %></span>
                                <br />
                                шир <%#((SearchResult)Container.DataItem).latitude %>, долг <%#((SearchResult)Container.DataItem).longitude %>
                                <br />
                                <img style="vertical-align: top" id="imgZodiac" runat="server" src='<%#"Images/zodiac_" + Utils.UsrZodiac(Container.DataItem) + ".png" %>' visible='<%#Utils.UsrHasZodiac(Container.DataItem) %>' />
                                <span class="zodiac_in_search" id="lblZodiac" runat="server"><%#Utils.ZodiacToString(int.Parse(Utils.UsrZodiac(Container.DataItem)))%></span><br />
                                <span><span class="property">Интересы</span>: <%#Utils.UsrInterests(Container.DataItem) %></span><br />
                                <span><span class="property">Цель знакомства</span>: </span><%#Utils.ReasonToString(Utils.UsrReason(Container.DataItem)) %> 
                                <tc:Expando ID="expContacts" runat="server" Caption="Контакты" IsExpanded="false" ExpandedCaptionCssClass="expando_caption expanded" CollapsedCaptionCssClass="expando_caption collapsed" ContentsCssClass="expando_contents" CssClass="expando_container">
                                    <span runat="server" id="lblPhone" visible='<%#Utils.UsrHasPhone(((ListViewItem)Container.Parent).DataItem) %>'>
                                        <img src="Images/phone.png" alt="тел." />
                                        <%#Utils.UsrPhone( ((ListViewItem)Container.Parent).DataItem) %>
                                        <br />
                                    </span>
                                    <span runat="server" id="lblICQ" visible='<%#Utils.UsrHasICQ(((ListViewItem)Container.Parent).DataItem) %>'>
                                        <img src="Images/icq.png" alt="ICQ" />
                                        <%#Utils.UsrICQ(((ListViewItem)Container.Parent).DataItem)%>
                                        <br />
                                    </span>
                                    <span runat="server" id="lblJabber" visible='<%#Utils.UsrHasJabber(((ListViewItem)Container.Parent).DataItem) %>'>
                                        <img src="Images/jabber.png" alt="Jabber" />
                                        <%#Utils.UsrJabber(((ListViewItem)Container.Parent).DataItem)%>
                                    </span>
                                </tc:Expando>
                                <tc:Expando ID="expTTX" runat="server" Caption="Тактико-технические характеристики" IsExpanded="false" ExpandedCaptionCssClass="expando_caption expanded" CollapsedCaptionCssClass="expando_caption collapsed" ContentsCssClass="expando_contents" CssClass="expando_container">
                                    <span runat="server" id="lblEyes" visible='<%#Utils.UsrHasEyeColor(((ListViewItem)Container.Parent).DataItem) %>'>
                                        глаза: <img runat="server" alt="цвет глаз" src='<%#"Images/eyes_" + Utils.UsrEyeColor(((ListViewItem)Container.Parent).DataItem) + ".png" %>' /> <%#Utils.EyesToString(Utils.UsrEyeColor(((ListViewItem)Container.Parent).DataItem))%>
                                        <br />
                                    </span>
                                    
                                    <span runat="server" id="lblHair" visible='<%#Utils.UsrHasHairColor(((ListViewItem)Container.Parent).DataItem) %>'>
                                        цвет волос: <img runat="server" alt="цвет волос" src='<%#"Images/hair_" + Utils.UsrHairColor(((ListViewItem)Container.Parent).DataItem) + ".png" %>' /> <%#Utils.HairToString(Utils.UsrHairColor(((ListViewItem)Container.Parent).DataItem))%>
                                        <br />
                                    </span>

                                    <span runat="server" id="lblHeight" visible='<%#Utils.UsrHasHeight(((ListViewItem)Container.Parent).DataItem) %>'>
                                        рост <%#Utils.UsrHeight(((ListViewItem)Container.Parent).DataItem)%> <small>м</small>
                                        <br />
                                    </span>

                                    <span runat="server" id="lblWeight" visible='<%#Utils.UsrHasWeight(((ListViewItem)Container.Parent).DataItem) %>'>
                                        вес <%#Utils.UsrWeight(((ListViewItem)Container.Parent).DataItem)%> <small>кг</small>
                                        <br />
                                    </span>

                                    <span runat="server" id="lblProportions" visible='<%#Utils.UsrHasProportions(((ListViewItem)Container.Parent).DataItem) %>'>
                                        пропорции <small>(грудь-талия-бедро)</small> <%#Utils.UsrProportions(((ListViewItem)Container.Parent).DataItem)%>
                                        <br />
                                    </span>

                                    <span runat="server" id="lblMainSize" visible='<%#Utils.UsrHasMainSize(((ListViewItem)Container.Parent).DataItem) %>'>
                                        размер <small>(хм)</small> <%#Utils.SizeToString(Utils.UsrMainSize(((ListViewItem)Container.Parent).DataItem))%>
                                    </span>
                                </tc:Expando>
                                <tc:Expando ID="expAbout" Caption="Кратко о себе" runat="server" IsExpanded="false" ExpandedCaptionCssClass="expando_caption expanded" CollapsedCaptionCssClass="expando_caption collapsed" ContentsCssClass="expando_contents" CssClass="expando_container">
                                    <%#Utils.UsrBio(((ListViewItem)Container.Parent).DataItem)%>
                                </tc:Expando>
                                <a runat="server" id="cmdSendMsg" class="linkbtn" href='<%#"NewMessage.aspx?nm=" + HttpUtility.HtmlEncode(Utils.UsrFirstName(Container.DataItem) + " " + Utils.UsrLastName(Container.DataItem)) + "&to=" + Utils.UsrId(Container.DataItem) %>'>Отправить сообщение</a>
                            </div>
                        </div>
                    </ItemTemplate>

                    <AlternatingItemTemplate>
                        <div class="usr alternating" style="display: block;">
                            <div class="cell defaultpadding">
                                <asp:Image runat="server" ID="imgMe" ImageAlign="Middle" CssClass="small_photo" ImageUrl='<%#"Photo.aspx?id=" + Utils.UsrId(Container.DataItem)%>' AlternateText='<%#Utils.UsrFirstName(Container.DataItem) + " " + Utils.UsrLastName(Container.DataItem)%>' /><br />
                            </div>
                            <div class="cell padding_notopleft">
                                <asp:Image runat="server" ID="imgGender" ImageUrl='<%#"Images/gender_" + Utils.UsrGender(Container.DataItem) + ".png" %>' AlternateText="Пол" />
                                <span class="user_name_in_search"><%#Utils.UsrFirstName(Container.DataItem) + " " + Utils.UsrLastName(Container.DataItem) %></span>
                                <span class="user_age_in_search"><%#Utils.UsrAge(Container.DataItem) %></span>
                                <br />
                                шир <%#((SearchResult)Container.DataItem).latitude %>, долг <%#((SearchResult)Container.DataItem).longitude %>
                                <br />
                                <img style="vertical-align: top" id="imgZodiac" runat="server" src='<%#"Images/zodiac_" + Utils.UsrZodiac(Container.DataItem) + ".png" %>' visible='<%#Utils.UsrHasZodiac(Container.DataItem) %>' />
                                <span class="zodiac_in_search" id="lblZodiac" runat="server"><%#Utils.ZodiacToString(int.Parse(Utils.UsrZodiac(Container.DataItem)))%></span><br />
                                <span><span class="property">Интересы</span>: <%#Utils.UsrInterests(Container.DataItem) %></span><br />
                                <span><span class="property">Цель знакомства</span>: </span><%#Utils.ReasonToString(Utils.UsrReason(Container.DataItem)) %> 
                                <tc:Expando ID="expContacts" runat="server" Caption="Контакты" IsExpanded="false" ExpandedCaptionCssClass="expando_caption expanded" CollapsedCaptionCssClass="expando_caption collapsed" ContentsCssClass="expando_contents" CssClass="expando_container">
                                    <span runat="server" id="lblPhone" visible='<%#Utils.UsrHasPhone(((ListViewItem)Container.Parent).DataItem) %>'>
                                        <img src="Images/phone.png" alt="тел." />
                                        <%#Utils.UsrPhone( ((ListViewItem)Container.Parent).DataItem) %>
                                        <br />
                                    </span>
                                    <span runat="server" id="lblICQ" visible='<%#Utils.UsrHasICQ(((ListViewItem)Container.Parent).DataItem) %>'>
                                        <img src="Images/icq.png" alt="ICQ" />
                                        <%#Utils.UsrICQ(((ListViewItem)Container.Parent).DataItem)%>
                                        <br />
                                    </span>
                                    <span runat="server" id="lblJabber" visible='<%#Utils.UsrHasJabber(((ListViewItem)Container.Parent).DataItem) %>'>
                                        <img src="Images/jabber.png" alt="Jabber" />
                                        <%#Utils.UsrJabber(((ListViewItem)Container.Parent).DataItem)%>
                                    </span>
                                </tc:Expando>
                                <tc:Expando ID="expTTX" runat="server" Caption="Тактико-технические характеристики" IsExpanded="false" ExpandedCaptionCssClass="expando_caption expanded" CollapsedCaptionCssClass="expando_caption collapsed" ContentsCssClass="expando_contents" CssClass="expando_container">
                                    <span runat="server" id="lblEyes" visible='<%#Utils.UsrHasEyeColor(((ListViewItem)Container.Parent).DataItem) %>'>
                                        глаза: <img id="Img1" runat="server" alt="цвет глаз" src='<%#"Images/eyes_" + Utils.UsrEyeColor(((ListViewItem)Container.Parent).DataItem) + ".png" %>' /> <%#Utils.EyesToString(Utils.UsrEyeColor(((ListViewItem)Container.Parent).DataItem))%>
                                        <br />
                                    </span>
                                    
                                    <span runat="server" id="lblHair" visible='<%#Utils.UsrHasHairColor(((ListViewItem)Container.Parent).DataItem) %>'>
                                        цвет волос: <img id="Img2" runat="server" alt="цвет волос" src='<%#"Images/hair_" + Utils.UsrHairColor(((ListViewItem)Container.Parent).DataItem) + ".png" %>' /> <%#Utils.HairToString(Utils.UsrHairColor(((ListViewItem)Container.Parent).DataItem))%>
                                        <br />
                                    </span>

                                    <span runat="server" id="lblHeight" visible='<%#Utils.UsrHasHeight(((ListViewItem)Container.Parent).DataItem) %>'>
                                        рост <%#Utils.UsrHeight(((ListViewItem)Container.Parent).DataItem)%> <small>м</small>
                                        <br />
                                    </span>

                                    <span runat="server" id="lblWeight" visible='<%#Utils.UsrHasWeight(((ListViewItem)Container.Parent).DataItem) %>'>
                                        вес <%#Utils.UsrWeight(((ListViewItem)Container.Parent).DataItem)%> <small>кг</small>
                                        <br />
                                    </span>

                                    <span runat="server" id="lblProportions" visible='<%#Utils.UsrHasProportions(((ListViewItem)Container.Parent).DataItem) %>'>
                                        пропорции <small>(грудь-талия-бедро)</small> <%#Utils.UsrProportions(((ListViewItem)Container.Parent).DataItem)%>
                                        <br />
                                    </span>

                                    <span runat="server" id="lblMainSize" visible='<%#Utils.UsrHasMainSize(((ListViewItem)Container.Parent).DataItem) %>'>
                                        размер <small>(хм)</small> <%#Utils.SizeToString(Utils.UsrMainSize(((ListViewItem)Container.Parent).DataItem))%>
                                    </span>
                                </tc:Expando>
                                <tc:Expando ID="expAbout" Caption="Кратко о себе" runat="server" IsExpanded="false" ExpandedCaptionCssClass="expando_caption expanded" CollapsedCaptionCssClass="expando_caption collapsed" ContentsCssClass="expando_contents" CssClass="expando_container">
                                    <%#Utils.UsrBio(((ListViewItem)Container.Parent).DataItem)%>
                                </tc:Expando>
                                <a runat="server" id="cmdSendMsg" class="linkbtn" href='<%#"NewMessage.aspx?nm=" + HttpUtility.HtmlEncode(Utils.UsrFirstName(Container.DataItem) + " " + Utils.UsrLastName(Container.DataItem)) + "&to=" + Utils.UsrId(Container.DataItem) %>'>Отправить сообщение</a>
                            </div>
                        </div>
                    </AlternatingItemTemplate>

                    <EmptyDataTemplate>
                        <span class="short_description">Ничего не найдено.</span>
                    </EmptyDataTemplate>
                </asp:ListView>
            </div>

            <div class="pager">
                Страница:
                <asp:DataPager ID="dpCites" PagedControlID="rptResults" runat="server">
                    <Fields>
                        <asp:NextPreviousPagerField ButtonType="Link" ShowFirstPageButton="True" 
                            ShowNextPageButton="False" ShowPreviousPageButton="False" FirstPageText="Первая" />
                        <asp:NumericPagerField />
                        <asp:NextPreviousPagerField ButtonType="Link" ShowLastPageButton="True" 
                            ShowNextPageButton="False" ShowPreviousPageButton="False" LastPageText="Последняя" />
                    </Fields>
                </asp:DataPager>    
            </div>
        </div>
    </tc:Expando>
    <h1>Карта результатов</h1>
    <input runat="server" type="hidden" id="hfInitUsers" value="" clientidmode="Static" />
    <div id="pnlMap" runat="server">
        <div id="map" class="mapdiv"></div>
    </div>
</asp:Content>
